// source --> http://michael-seymour.com/wp-content/plugins/jetpack/modules/related-posts/related-posts.js?ver=20150408 /* jshint onevar: false */ /* globals related_posts_js_options */ /** * Load related posts */ (function($) { var jprp = { response: null, /** * Utility get related posts JSON endpoint from URLs * * @param {string} URL (optional) * @return {string} Endpoint URL */ getEndpointURL: function( URL ) { var locationObject, is_customizer = 'undefined' !== typeof wp && wp.customize && wp.customize.settings && wp.customize.settings.url && wp.customize.settings.url.self; // If we're in Customizer, write the correct URL. if ( is_customizer ) { locationObject = document.createElement( 'a' ); locationObject.href = wp.customize.settings.url.self; } else { locationObject = document.location; } if ( 'string' === typeof( URL ) && URL.match( /^https?:\/\// ) ) { locationObject = document.createElement( 'a' ); locationObject.href = URL; } var args = 'relatedposts=1'; if ( $( '#jp-relatedposts' ).data( 'exclude' ) ) { args += '&relatedposts_exclude=' + $( '#jp-relatedposts' ).data( 'exclude' ); } if ( is_customizer ) { args += '&jetpackrpcustomize=1'; } var pathname = locationObject.pathname; if ( '/' !== pathname[0] ) { pathname = '/' + pathname; } if ( '' === locationObject.search ) { return pathname + '?' + args; } else { return pathname + locationObject.search + '&' + args; } }, getAnchor: function( post, classNames ) { var anchor_title = post.title; if ( '' !== ( '' + post.excerpt ) ) { anchor_title += '\n\n' + post.excerpt; } var anchor = $( '' ); anchor.attr({ 'class': classNames, 'href': post.url, 'title': anchor_title, 'rel': post.rel, 'data-origin': post.url_meta.origin, 'data-position': post.url_meta.position }); var anchor_html = $( '
' ).append( anchor ).html(); return [ anchor_html.substring( 0, anchor_html.length-4 ), '' ]; }, generateMinimalHtml: function( posts, options ) { var self = this; var html = ''; $.each( posts, function( index, post ) { var anchor = self.getAnchor( post, 'jp-relatedposts-post-a' ); var classes = 'jp-relatedposts-post jp-relatedposts-post' + index; if ( post.classes.length > 0 ) { classes += ' ' + post.classes.join( ' ' ); } html += '

'; html += ''; if ( options.showDate ) { html += ''; } if ( options.showContext ) { html += ''; } html += '

'; } ); return ''; }, generateVisualHtml: function( posts, options ) { var self = this; var html = ''; $.each( posts, function( index, post ) { var anchor = self.getAnchor( post, 'jp-relatedposts-post-a' ); var classes = 'jp-relatedposts-post jp-relatedposts-post' + index; if ( post.classes.length > 0 ) { classes += ' ' + post.classes.join( ' ' ); } if ( ! post.img.src ) { classes += ' jp-relatedposts-post-nothumbs'; } else { classes += ' jp-relatedposts-post-thumbs'; } html += '
'; if ( post.img.src ) { html += anchor[0] + '' + anchor[1]; } else { var anchor_overlay = self.getAnchor( post, 'jp-relatedposts-post-a jp-relatedposts-post-aoverlay' ); html += anchor_overlay[0] + anchor_overlay[1]; } html += '<' + related_posts_js_options.post_heading + ' class="jp-relatedposts-post-title">' + anchor[0] + post.title + anchor[1] + ''; html += '

' ).text( post.excerpt ).html() + '

'; if ( options.showDate ) { html += ''; } if ( options.showContext ) { html += ''; } html += '
'; } ); return ''; }, /** * We want to set a max height on the excerpt however we want to set * this according to the natual pacing of the page as we never want to * cut off a line of text in the middle so we need to do some detective * work. */ setVisualExcerptHeights: function() { var elements = $( '#jp-relatedposts .jp-relatedposts-post-nothumbs .jp-relatedposts-post-excerpt' ); if ( 0 >= elements.length ) { return; } var fontSize = parseInt( elements.first().css( 'font-size' ), 10 ), lineHeight = parseInt( elements.first().css( 'line-height' ), 10 ); // Show 5 lines of text elements.css( 'max-height', ( 5 * lineHeight / fontSize ) + 'em' ); }, getTrackedUrl: function( anchor ) { var args = 'relatedposts_hit=1'; args += '&relatedposts_origin=' + $( anchor ).data( 'origin' ); args += '&relatedposts_position=' + $( anchor ).data( 'position' ); var pathname = anchor.pathname; if ( '/' !== pathname[0] ) { pathname = '/' + pathname; } if ( '' === anchor.search ) { return pathname + '?' + args; } else { return pathname + anchor.search + '&' + args; } }, cleanupTrackedUrl: function() { if ( 'function' !== typeof history.replaceState ) { return; } var cleaned_search = document.location.search.replace( /\brelatedposts_[a-z]+=[0-9]*&?\b/gi, '' ); if ( '?' === cleaned_search ) { cleaned_search = ''; } if ( document.location.search !== cleaned_search ) { history.replaceState( {}, document.title, document.location.pathname + cleaned_search ); } } }; /** * Initialize Related Posts. */ function startRelatedPosts() { jprp.cleanupTrackedUrl(); var endpointURL = jprp.getEndpointURL(), $relatedPosts = $( '#jp-relatedposts' ); $.getJSON( endpointURL, function( response ) { if ( 0 === response.items.length || 0 === $relatedPosts.length ) { return; } jprp.response = response; var html, showThumbnails, options = {}; if ( 'undefined' !== typeof wp && wp.customize ) { showThumbnails = wp.customize.instance( 'jetpack_relatedposts[show_thumbnails]' ).get(); options.showDate = wp.customize.instance( 'jetpack_relatedposts[show_date]' ).get(); options.showContext = wp.customize.instance( 'jetpack_relatedposts[show_context]' ).get(); options.layout = wp.customize.instance( 'jetpack_relatedposts[layout]' ).get(); } else { showThumbnails = response.show_thumbnails; options.showDate = response.show_date; options.showContext = response.show_context; options.layout = response.layout; } html = ! showThumbnails ? jprp.generateMinimalHtml( response.items, options ) : jprp.generateVisualHtml( response.items, options ); $relatedPosts.append( html ); jprp.setVisualExcerptHeights(); if ( options.showDate ) { $relatedPosts.find( '.jp-relatedposts-post-date' ).show(); } $relatedPosts.show(); $( '#jp-relatedposts a.jp-relatedposts-post-a' ).click(function() { this.href = jprp.getTrackedUrl( this ); }); } ); } $( function() { if ( 'undefined' !== typeof wp && wp.customize ) { if ( wp.customize.selectiveRefresh ) { wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function( placement ) { if ( 'jetpack_relatedposts' === placement.partial.id ) { startRelatedPosts(); } } ); } wp.customize.bind( 'preview-ready', startRelatedPosts ); } else { startRelatedPosts(); } } ); })(jQuery); // source --> http://michael-seymour.com/wp-content/plugins/crelly-slider/js/jquery.crellyslider.min.js?ver=1.2.2 /** * Plugin Name: Crelly Slider * Plugin URI: https://wordpress.org/plugins/crelly-slider/ * Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations. * Version: 1.2.2 * Author: Fabio Rinaldi * Author URI: https://github.com/fabiorino * License: MIT */ var crellyslider_youtube_api_ready=!1,crellyslider_vimeo_api_ready=!1;!function(a){function b(){var a=document.createElement("script");a.src="https://www.youtube.com/iframe_api";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b),crellyslider_youtube_api_ready=!0}function c(){(function(){function a(b){return new a.fn.init(b)}function b(a,b,c){return!!c.contentWindow.postMessage&&(a=JSON.stringify({method:a,value:b}),void c.contentWindow.postMessage(a,g))}function c(a){var b,c;try{b=JSON.parse(a.data),c=b.event||b.method}catch(a){}if("ready"!=c||f||(f=!0),!/^https?:\/\/player.vimeo.com/.test(a.origin))return!1;"*"===g&&(g=a.origin),a=b.value;var d=b.data,h=""===h?null:b.player_id;return b=h?e[h][c]:e[c],c=[],!!b&&(void 0!==a&&c.push(a),d&&c.push(d),h&&c.push(h),0-1&&(h=C),g)for(m=h.length,j;m;)j=h[--m],b[j]=g[j];if(f.search(/mouse(down|up)|click/)>-1&&!b.which&&(b.which=1),f.search(/^touch/)!==-1&&(i=e(g),f=i.touches,k=i.changedTouches,l=f&&f.length?f[0]:k&&k.length?k[0]:d,l))for(n=0,o=A.length;nf||Math.abs(c.pageY-G)>f,H&&!d&&o("vmousecancel",b,h),o("vmousemove",b,h),m()}}function t(a){if(!K){j();var c,d,b=g(a.target);o("vmouseup",a,b),H||(c=o("vclick",a,b),c&&c.isDefaultPrevented()&&(d=e(a).changedTouches[0],I.push({touchID:O,x:d.clientX,y:d.clientY}),J=!0)),o("vmouseout",a,b),H=!1,m()}}function u(b){var d,c=a.data(b,x);if(c)for(d in c)if(c[d])return!0;return!1}function v(){}function w(b){var c=b.substr(1);return{setup:function(){u(this)||a.data(this,x,{});var d=a.data(this,x);d[b]=!0,D[b]=(D[b]||0)+1,1===D[b]&&M.bind(c,p),a(this).bind(c,v),L&&(D.touchstart=(D.touchstart||0)+1,1===D.touchstart&&M.bind("touchstart",q).bind("touchend",t).bind("touchmove",s).bind("scroll",r))},teardown:function(){--D[b],D[b]||M.unbind(c,p),L&&(--D.touchstart,D.touchstart||M.unbind("touchstart",q).unbind("touchmove",s).unbind("touchend",t).unbind("scroll",r));var d=a(this),e=a.data(this,x);e&&(e[b]=!1),d.unbind(c,v),u(this)||d.removeData(x)}}}var P,Q,x="virtualMouseBindings",y="virtualTouchID",z="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),A="clientX clientY pageX pageY screenX screenY".split(" "),B=a.event.mouseHooks?a.event.mouseHooks.props:[],C=a.event.props.concat(B),D={},E=0,F=0,G=0,H=!1,I=[],J=!1,K=!1,L="addEventListener"in c,M=a(c),N=1,O=0;for(a.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500},Q=0;QMath.floor(a.pageY)||0===a.pageX&&Math.floor(e)>Math.floor(a.pageX)?(e-=c,f-=d):(fa.event.special.swipe.horizontalDistanceThreshold&&Math.abs(b.coords[1]-c.coords[1])c.coords[0]?"swipeleft":"swiperight";return e(d,"swipe",a.Event("swipe",{target:f,swipestart:b,swipestop:c}),!0),e(d,g,a.Event(g,{target:f,swipestart:b,swipestop:c}),!0),!0}return!1},eventInProgress:!1,setup:function(){var b,c=this,d=a(c),e={};b=a.data(this,"mobile-events"),b||(b={length:0},a.data(this,"mobile-events",b)),b.length++,b.swipe=e,e.start=function(b){if(!a.event.special.swipe.eventInProgress){a.event.special.swipe.eventInProgress=!0;var d,g=a.event.special.swipe.start(b),h=b.target,i=!1;e.move=function(b){g&&!b.isDefaultPrevented()&&(d=a.event.special.swipe.stop(b),i||(i=a.event.special.swipe.handleSwipe(g,d,c,h),i&&(a.event.special.swipe.eventInProgress=!1)),Math.abs(g.coords[0]-d.coords[0])>a.event.special.swipe.scrollSupressionThreshold&&b.preventDefault())},e.stop=function(){i=!0,a.event.special.swipe.eventInProgress=!1,f.off(k,e.move),e.move=null},f.on(k,e.move).one(j,e.stop)}},d.on(i,e.start)},teardown:function(){var b,c;b=a.data(this,"mobile-events"),b&&(c=b.swipe,delete b.swipe,b.length--,0===b.length&&a.removeData(this,"mobile-events")),c&&(c.start&&a(this).off(i,c.start),c.move&&f.off(k,c.move),c.stop&&f.off(j,c.stop))}},a.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(b,c){a.event.special[b]={setup:function(){a(this).bind(c,a.noop)},teardown:function(){a(this).unbind(c)}}})}(a,this)}),a.CrellySlider=function(d,e){function y(a){return"youtube"==a?f.find(".cs-yt-iframe").length>0:"vimeo"==a?f.find(".cs-vimeo-iframe").length>0:-1}function z(){if(f.wrapInner('
'),f.find(g+" > ul").addClass("cs-slides"),f.find(g+" "+h+" > li").addClass("cs-slide"),k=Z().length,0==k)return!1;if(1==k){var a=$(0),b=f.find(g).find(h);a.clone().prependTo(b),k++}if(A(),e.showControls&&f.find(g).append('
'),e.showNavigation){for(var c='
',d=0;d';c+="
",f.find(g).append(c)}e.showProgressBar?f.find(g).append('
'):f.find(g).append('
'),f.css("display","block"),e.responsive&&O(),K(),Z().find(".cs-background-link").html(" ").data({left:0,top:0,in:"none",out:"none",easeIn:0,easeOut:0,delay:0,time:"all"}),I(),B().done(function(){var a=setInterval(function(){"complete"==document.readyState&&f.find(g).find(".cs-preloader").length>0&&(clearInterval(a),E())},100)})}function A(){if(e.randomOrder||0!=e.startFromSlide){var a=new Array,b=new Array;if(e.startFromSlide==-1){var c=Math.floor(Math.random()*k);a[0]=c,b[0]=$(c)}else a[0]=e.startFromSlide,b[0]=$(e.startFromSlide);for(var d=1;dU()&&U() .cs-previous").click(function(){fa(X())}),f.find(g).find(".cs-controls > .cs-next").click(function(){fa(W())}),e.enableSwipe&&(f.find(g).on("swipeleft",function(){T(),fa(W())}),f.find(g).on("swiperight",function(){T(),fa(X())})),f.find(g).find(".cs-navigation > .cs-slide-link").click(function(){fa(a(this).index())}),e.pauseOnHover&&(f.find(g).find(h).hover(function(){S()}),f.find(g).find(h).mouseleave(function(){T()}))}function I(){function c(){f.find(g).append('
'),f.find(g).find(".cs-preloader").css({"background-color":$(l).css("background-color"),"background-image":$(l).css("background-image"),"background-position":$(l).css("background-position"),"background-repeat":$(l).css("background-repeat"),"background-size":$(l).css("background-size")}),f.find(g).find(".cs-preloader > .cs-bg").css({"background-color":$(l).css("background-color"),"background-image":$(l).css("background-image"),"background-position":$(l).css("background-position"),"background-repeat":$(l).css("background-repeat"),"background-size":$(l).css("background-size")})}f.find(g).find(h).css("visibility","hidden"),f.find(g).find(".cs-progress-bar").css("display","none"),f.find(g).find(".cs-navigation").css("display","none"),f.find(g).find(".cs-controls").css("display","none");var b=$(0).css("background-image");b=b.replace(/^url\(["']?/,"").replace(/["']?\)$/,""),b.match(/\.(jpeg|jpg|gif|png|bmp|tiff|tif)$/)?a("").load(function(){c()}).attr("src",b).each(function(){this.complete&&a(this).load()}):c()}function J(){f.find(g).find(h).css("visibility","visible"),f.find(g).find(".cs-progress-bar").css("display","block"),f.find(g).find(".cs-navigation").css("display","block"),f.find(g).find(".cs-controls").css("display","block"),ya($(0)),$(0).finish(),f.find(g).find(".cs-preloader").animate({opacity:0},300,function(){f.find(g).find(".cs-preloader").remove()})}function K(){var b,c,a=e.layout;switch(a){case"fixed":b=e.startWidth,c=e.startHeight,f.find(g).css({width:P(b),height:P(c)}),Z().css({width:P(b),height:P(c)});break;case"full-width":b=f.width(),c=e.startHeight,f.find(g).css({width:b,height:P(c)}),Z().css({width:b,height:P(c)});break;default:return!1}}function L(a){var b=(V()-e.startHeight)/2,c=(U()-e.startWidth)/2,d=0,f=0;return b>0&&(d=b),c>0&&(f=c),{top:d,left:f}}function M(){e.beforeSetResponsive();var b=Z();R(!0),b.each(function(){var b=a(this),c=b.find(j);b.finish(),ya(b),b.finish(),c.each(function(){var b=a(this);b.finish(),Aa(b),b.finish(),ja(b)&&ma(b)})}),O(),K(),b.each(function(){var b=a(this),c=b.find(j);c.each(function(){var b=a(this);b.find("*").each(function(){var b=a(this);N(b)}),N(b),b.finish(),Ba(b),b.finish(),ja(b)&&ma(b)}),b.finish(),za(b),b.finish()}),w=a(window).width(),Q()}function N(a){a.css({top:P(Y(a,"top")+L(a).top),left:P(Y(a,"left")+L(a).left),"padding-top":P(Y(a,"padding-top")),"padding-right":P(Y(a,"padding-right")),"padding-bottom":P(Y(a,"padding-bottom")),"padding-left":P(Y(a,"padding-left"))}),a.is("input")||a.is("button")||a.text().trim().length?a.css({"line-height":P(Y(a,"line-height"))+"px","letter-spacing":P(Y(a,"letter-spacing")),"font-size":P(Y(a,"font-size"))}):a.css({width:P(Y(a,"width")),height:P(Y(a,"height"))})}function O(){var a=f.width(),b=e.startWidth;v=a>=b||!e.responsive?1:a/b}function P(a){return a*v}function Q(){e.automaticSlide?ba():ga(l),p=!1}function R(b){for(var c=0;c .cs-slide-link");c.each(function(){var b=a(this);b.index()==l?b.addClass("cs-active"):b.removeClass("cs-active")})}function fa(a){a!=l&&(n||o)&&(R(!1),ia(l,!1,!0).done(function(){l=a,Q()}))}function ga(b){e.beforeSlideStart();var c=new a.Deferred;o=!1;for(var d=0;d *",l=0,m=!1,n=!1,o=!1,p=!0,q=new _(function(){},0),r=new Array,s=new Array,t={},u={},v=1,w=0;if(!crellyslider_youtube_api_ready&&y("youtube")&&b(),!crellyslider_vimeo_api_ready&&y("vimeo")&&c(),!crellyslider_youtube_api_ready||"undefined"!=typeof YT&&"undefined"!=typeof YT.Player)z();else var x=setInterval(function(){"undefined"!=typeof YT&&"undefined"!=typeof YT.Player&&(clearInterval(x),z())},100);this.resume=function(){T()},this.pause=function(){S()},this.nextSlide=function(){fa(W())},this.previousSlide=function(){fa(X())},this.changeSlide=function(a){fa(a)},this.getCurrentSlide=function(){return l},this.getTotalSlides=function(){return k}},a.fn.crellySlider=function(b){var c=a.extend({layout:"fixed",responsive:!0,startWidth:1140,startHeight:500,pauseOnHover:!0,automaticSlide:!0,randomOrder:!0,startFromSlide:0,showControls:!0,showNavigation:!0,showProgressBar:!0,enableSwipe:!0,slidesTime:3e3,elementsDelay:0,elementsTime:"all",slidesEaseIn:300,elementsEaseIn:300,slidesEaseOut:300,elementsEaseOut:300,ignoreElementsEaseOut:!1,videoAutoplay:!1,videoLoop:!1,beforeStart:function(){},beforeSetResponsive:function(){},beforeSlideStart:function(){},beforePause:function(){},beforeResume:function(){}},b);return this.each(function(){if(void 0==a(this).data("crellySlider")){var b=new a.CrellySlider(this,c);a(this).data("crellySlider",b)}})}}(jQuery);